package com.shuangti.order.controller;


import com.shuangti.order.bean.OrderTbl;
import com.shuangti.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    @Autowired
    OrderService orderService;

    @GetMapping("/create")
    public String create(@RequestParam("user_id") Long user_id,
                         @RequestParam("product_id") Long product_id,
                         @RequestParam("count") int count,
                         @RequestParam("shipping_address") String shipping_address)
    {
        OrderTbl tbl = orderService.create(user_id,product_id,count,shipping_address);
        return "order create success = 订单id：【"+tbl.getOrder_id()+"】";
    }
}
